package analysis;

import common.AnalysisWare;
import common.Constants;
import common.DataAnalysis;
import util.FileUtil;
import util.mysql.MysqlUtil;
import util.remote.RemoteConnectResult;

import java.util.List;
import java.util.Map;

/**
 * Created by J.Chen on 2017/5/27.
 */

@AnalysisWare(confCode = "ACT_2017_04_HAPPY_7_DAY", desc = "新手七天乐")
public class Happy7DayAnalysis extends DataAnalysis {


    public Happy7DayAnalysis(RemoteConnectResult result, String confCode) {
        super(result, confCode);

    }

    @Override
    public void execute() {
        String sql = MysqlUtil.getBusinessLogSql("d1 `days`,d2 `type`,d3 `index`,d4 `handle`,COUNT(1) `num`", " d1,d2,d3,d4 ", actConf, "doLoginGift", 1, null, " d4>0", "`days`,`type`,`index`,`handle`");
        List<Map<String, String>> list1 = result.getMysqlUtil().selectList(sql);
        FileUtil fileUtil = new FileUtil(Constants.getActOutputDir(result.getRemoteConf(), actConf.getConfCode()));
        fileUtil.writeMysqlList(list1, "|", "days", "type", "index", "handle", "num");
        fileUtil.close();
    }
}
